(in-package :moneychanger)

;; This uses xml-psychiatrist to validate the XML file enough for our
;; purposes. Isn't this a nice little schema?

(defun validate-currency-list (&optional (filename "currency.xml"))
  (toplevel-match
   (tag "RateList" ()
	(tag+ "Rate" ((match-anything :how-many :zero-or-more))
	      (tag "Date" ()
		   (pcdata))
	      (tag "Country" ((attr "UnitName"))
		   (pcdata))
	      (tag "Value" ((attr "InUsd" :possible-values '("true" "false")))
		   (pcdata))))
   (parse-file filename)))